package main

import "fmt"

type Course struct {
	Name  string
	Price int
	Url   string
}
type Printer interface {
}

func (c Course) printInfo() string {
	return "课程信息"
}

type AliOss struct {
}
type LocalFile struct {
}

func store(x interface{}) {
	//switch v := x.(type) {
	//case AliOss:
	//case LocalFile:
	//}

}

func print(x interface{}) {
	switch v := x.(type) {
	case string:
		fmt.Printf("字符串:%s\n", v)
	case int:
		fmt.Printf("整数:%d\n", v)
	}
	//v, ok := x.(int)
	fmt.Printf("%v\n", x)
}

func main() {
	//	空接口类似于python和java的object
	var i interface{}
	//i = Course{}
	//fmt.Println(i)
	i = 10
	print(i)
	i = "bobby"
	print(i)
	i = []string{"django", "scrapy"}
	print(i)
	//参数传递   可以作为map的值
	var teacherInfo = make(map[string]interface{})
	teacherInfo["name"] = 18
	teacherInfo["age"] = 12
	teacherInfo["weigth"] = "75.2"
	teacherInfo["courses"] = []string{"django", "scrapy"}
	fmt.Printf("%v", teacherInfo)
	//	断言
	//c := &Course{}
	//var c Printer = Course{}

}
